<template>
  <div class="tabbar-column">
    <!--draggable = ".draggableItem"-->
    <draggable
      :list="list"
      v-bind="$attrs"
      :set-data="setData"
      class="board-column-content"
      @change="onChange">
      <div v-for="element in list" v-if="element['display']===1" :key="element['id']" class="board-item">
        <el-image :src="element['iconPath']" class="board-item-icon" style="border-radius: 8px;">
          <div slot="error" class="board-item-icon">
            <i class="el-icon-picture-outline"/>
          </div>
        </el-image>
        <label class="board-item-label">{{ element['text'] || '--' }}</label>
      </div>
    </draggable>
  </div>
</template>
<script>
import draggable from 'vuedraggable';
export default {
  name: 'DragKanbanDemo',
  components: {
    draggable
  },
  props: {
    options: {
      type: Object,
      default() {
        return {}
      }
    },
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    setData(dataTransfer) {
      dataTransfer.setData('Text', '');
    },
    onChange() {
      this.$emit('change');
    }
  }
}
</script>
<style lang="scss" scoped>
.tabbar-column {
  width: 373px;
  background: #f0f0f0;
  border-radius: 3px;

  .board-column-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    border-top: 2px solid #f1f2f3;
    border-bottom: 2px solid #f1f2f3;
    background-color: #fff;

    .board-item {
      height: 100px;
      cursor: pointer;
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      text-align: center;
      box-sizing: border-box;
    }

    .board-item-icon {
      width: 40px;
      height: 40px;
      line-height: 40px;
      margin-bottom: 10px;
    }

    .board-item-label {
      color: #101010;
      font-size: 13px;
    }
  }
}
</style>

